// import com.alibaba.druid.DbType;
// import com.alibaba.druid.sql.ast.SQLExpr;
// import com.alibaba.druid.sql.ast.SQLName;
// import com.alibaba.druid.sql.ast.SQLStatement;
// import com.alibaba.druid.sql.ast.statement.SQLAlterStatement;
// import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlASTVisitor;

#include "MySqlCreateEventStatement.h"
#include "../../../../../DbType.h"
#include "../../../../ast/SQLExpr.h"
#include "../../../../ast/SQLName.h"
#include "../../../../ast/SQLStatement.h"
#include "../../visitor/MySqlASTVisitor.h"
#include "MySqlEventSchedule.h"

MySqlCreateEventStatement::MySqlCreateEventStatement()
{
  setDbType(DbType_ptr(new DbType(&DbType::mysql)));
}

SQLName_ptr MySqlCreateEventStatement::getDefiner()
{
  return definer;
}

void MySqlCreateEventStatement::setDefiner(SQLName_ptr definer)
{
  if (definer != nullptr)
  {
    definer->setParent(SharedObject(MySqlCreateEventStatement));
  }
  this->definer = definer;
}

SQLName_ptr MySqlCreateEventStatement::getName()
{
  return name;
}

void MySqlCreateEventStatement::setName(SQLName_ptr name)
{
  if (name != nullptr)
  {
    name->setParent(SharedObject(MySqlCreateEventStatement));
  }
  this->name = name;
}

MySqlEventSchedule_ptr MySqlCreateEventStatement::getSchedule()
{
  return schedule;
}

void MySqlCreateEventStatement::setSchedule(MySqlEventSchedule_ptr schedule)
{
  if (schedule != nullptr)
  {
    schedule->setParent(SharedObject(MySqlCreateEventStatement));
  }
  this->schedule = schedule;
}

BOOL_ptr MySqlCreateEventStatement::isOnCompletionPreserve()
{
  return onCompletionPreserve;
}

void MySqlCreateEventStatement::setOnCompletionPreserve(BOOL_ptr onCompletionPreserve)
{
  this->onCompletionPreserve = onCompletionPreserve;
}

SQLName_ptr MySqlCreateEventStatement::getRenameTo()
{
  return renameTo;
}

void MySqlCreateEventStatement::setRenameTo(SQLName_ptr renameTo)
{
  if (renameTo != nullptr)
  {
    renameTo->setParent(SharedObject(MySqlCreateEventStatement));
  }
  this->renameTo = renameTo;
}

BOOL_ptr MySqlCreateEventStatement::getEnable()
{
  return enable;
}

void MySqlCreateEventStatement::setEnable(BOOL_ptr enable)
{
  this->enable = enable;
}

BOOL_ptr MySqlCreateEventStatement::isDisableOnSlave()
{
  return disableOnSlave;
}

void MySqlCreateEventStatement::setDisableOnSlave(BOOL_ptr disableOnSlave)
{
  this->disableOnSlave = disableOnSlave;
}

SQLExpr_ptr MySqlCreateEventStatement::getComment()
{
  return comment;
}

void MySqlCreateEventStatement::setComment(SQLExpr_ptr comment)
{
  if (comment != nullptr)
  {
    comment->setParent(SharedObject(MySqlCreateEventStatement));
  }
  this->comment = comment;
}

SQLStatement_ptr MySqlCreateEventStatement::getEventBody()
{
  return eventBody;
}

void MySqlCreateEventStatement::setEventBody(SQLStatement_ptr eventBody)
{
  if (eventBody != nullptr)
  {
    eventBody->setParent(SharedObject(MySqlCreateEventStatement));
  }
  this->eventBody = eventBody;
}

BOOL_ptr MySqlCreateEventStatement::isIfNotExists()
{
  return ifNotExists;
}

void MySqlCreateEventStatement::setIfNotExists(BOOL_ptr ifNotExists)
{
  this->ifNotExists = ifNotExists;
}

void MySqlCreateEventStatement::accept0(MySqlASTVisitor_ptr visitor)
{
  if (visitor->visit(SharedObject(MySqlCreateEventStatement)))
  {
    acceptChild(visitor, definer);
    acceptChild(visitor, name);
    acceptChild(visitor, schedule);
    acceptChild(visitor, renameTo);
    acceptChild(visitor, comment);
    acceptChild(visitor, eventBody);
  }
  visitor->endVisit(SharedObject(MySqlCreateEventStatement));
}
